package com.example.aboutspringboot.service;

import com.example.aboutspringboot.entity.User;
import com.example.aboutspringboot.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    //按名查找一个用户信息
    public User selectOneUser(String username,String password) {
        return userMapper.selectOneUser(username,password);
    }
    //按名查找一个用户信息
    public User selectOneUserByUsername(String username) {
        return userMapper.selectOneUserByUsername(username);
    }

    //添加用户信息
    public int insertOneUser(User user) {
        return userMapper.insertOneUser(user);
    }

    //修改用户信息，不允许改名
    public int updateOneUser(User user) {
        return userMapper.updateOneUser(user);
    }

    //充钱
    public int addMoney(String username, double money) {
        return userMapper.addMoney(username, money);
    }
}
